<?php
/**
 * Created by Alan.
 * User: Alan
 * Date: 2018\10\8 0008
 * Time: 11:16
 */

namespace app\api\controller;

use think\Controller;
use app\common\model\City as CityModel;

class City extends Controller
{
    public function getCitysByParentId()
    {
        if(!request()->isPost()){
            return show(0,'error');
        }

        $parentId = intval(input('post.id',0));
        if(!$parentId){
            return show(0,'error');
        }

        $cities = CityModel::getNormalCityByParentId($parentId);
        if($cities){
            return show(1,'success',$cities);
        }
        else {
            return show(0,'error');
        }
    }
}